package com.zhangyu.shadow.repair.intercept;

import com.zhangyu.shadow.repair.config.ErrorCode;
import com.zhangyu.shadow.repair.event.TokenInvalidEvent;

import org.greenrobot.eventbus.EventBus;

import st.lib.base.net.interceptors.IDataInterceptor;

/**
 * @author zhangyu
 * @date 2018/11/7
 * 对错误码的拦截
 */

public class DataIntercept implements IDataInterceptor {

    @Override
    public boolean interceptor(int code, String msg, Object data) {
        if (ErrorCode.CODE_TOKEN_INVALID == code) {
            EventBus.getDefault().post(new TokenInvalidEvent());
        }
        return false;
    }
}
